using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SceneLogic : LuaBehivour
{
    public string sceneName;

    Action LuaActive;
    Action LuaInActive;
    Action LuaOnEnter;
    Action LuaOnQuit;

    public override void Init(string _luaName)
    {
        base.Init(_luaName);
        luaScriptEnv.Get("OnActive", out LuaActive);
        luaScriptEnv.Get("OnInActive", out LuaInActive);
        luaScriptEnv.Get("OnEnter", out LuaOnEnter);
        luaScriptEnv.Get("OnQuit", out LuaOnQuit);
    }

    public void OnActive()
    {
        LuaActive?.Invoke();
    }

    public void OnInActive()
    {
        LuaInActive?.Invoke();
    }

    public void OnEnter()
    {
        LuaOnEnter?.Invoke();
    }

    public void OnQuit()
    {
        LuaOnQuit?.Invoke();
    }

    protected override void ClearLua()
    {
        base.ClearLua();
        LuaActive = null;
        LuaInActive = null;
        LuaOnEnter = null;
        LuaOnQuit = null;
    }
}
